Loading
Scriptbox
 VBScript Links 
 About VBscript 
 JavaScript Links 
 About JavaScript 
 Powershell Links 
 PSCRIPT the Script Launcher 
 PowerShell Shortcut Keys 
 About Powershell 
     VBScript
    JavaScript
    Powershell
Disclaimer
Contact
Latest 10 Scripts
Script search
  :: { Category } :: 0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ
         

Search Options:  Take  Action  Based  on  the  First  Line  of  a  Text  File  

 Content of Take Action Based on the First Line of a Text File.vbs
MD5 Hash: 6CC1D3B0E85A3683803F4DF0E675C3F8
Const ForReading = 1

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery _
("ASSOCIATORS OF {Win32_Directory.Name='C:\Scripts'} Where " _
& "ResultClass = CIM_DataFile")

Set objFSO = CreateObject("Scripting.FileSystemObject")

For Each objItem In colItems
Set objFile = objFSO.OpenTextFile(objItem.Name, ForReading)
strLine = objFile.ReadLine
strLine = LCase(strLine)
objFile.Close

If InStr(strLine, "fabrikam.com") or InStr(strLine, "contoso.com") Then
objFSO.MoveFile objItem.Name, "C:\Archive\"
End If
Next



   © 2008 - 2013 Boris Toll      :: Scripts available: 6.481 ::      :: scriptbox.toll.at ::      :: powered by www.toll.at ::
  Google Entries:n/a
  Yahoo Backlinks:n/a
  Live Backlinks:n/a
  del.icio.us Bookmarks:n/a
  Technorati Links:n/a